package oop.java0322;

/**
 * 会员属性有会员号，姓名，手机号，积分，
 */
public class Card {
    private String cardNo;
    private String name;
    private String telePhone;
    private int score;

    public Card() {
    }

    public Card(String cardNo, String name, String telePhone, int score) {
        setName(name);
        setCardNo(cardNo);
        setTelePhone(telePhone);
        setScore(score);
//        this.cardNo = cardNo;
//        this.telePhone = telePhone;
//        this.score = score;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setTelePhone(String telePhone) {
        this.telePhone = telePhone;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        if(score>600){
            System.out.println("积分不可超过600");
            score=0;
        }
        this.score = score;
    }

    //减少积分操作
    public void decreaseScore(int no){
        if(no==1){
           score-=100;
        }
        if(no==2){
            score-=400;
        }
        if(no==3){
            score-=1000;
        }
    }
    //增加积分
    public void increaseScore(int score){
        this.score+=score;
    }

    public void showInfo() {
        System.out.println("卡号：" + cardNo+"，持卡人姓名：" + name+"，联系方式：" + telePhone+"，积分：" + score + "分");
    }

}
